package com.wangjj.basic;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.util.Scanner;

public class GetStandardDate {

	/**
	 * 从美国科罗拉多州博尔德市的国家标准与技术研究所
	 * 获得铯原子钟的计量时间。
	 */
	public static void main(String[] args) {
		Socket s = null;
		try {
			s = new Socket("time-A.timefreq.bldrdoc.gov",13);
			InputStream input = s.getInputStream();
			Scanner scanner = new Scanner(input);
			while(scanner.hasNextLine()) {
				String line = scanner.nextLine();
				System.out.println(line);
			}
		} catch(IOException e) {
			e.printStackTrace();
		} finally {
			try {
				s.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}

}
